const { LoginSdk,LoginPlatformType,LoginType,LoginEquipment,MemberSdk } = libSdk;
// 物流端匹配网址
window.UC_LIBSDK_LOGISTICS_HOSTNAME = ['zwlogistics', 'sandbox2log', 'logistics'];
window.uc_libsdk_utils = {
	isLogistics() {
		return window.UC_LIBSDK_LOGISTICS_HOSTNAME.find(item => location.hostname.indexOf(item) !== -1)
	}
}
// 根据网址域名来判断当前所在平台，物流端或者商户端
window.uc_libsdk_getEquipmentByUrl = () => {
	if (window.UC_LIBSDK_LOGISTICS_HOSTNAME.find(item => location.hostname.indexOf(item) !== -1)) {
		return LoginPlatformType.LOGISTICS_CLIENT;
	} else {
		return LoginPlatformType.BUSINESS_CLIENT;
	}
}
;(() => {
	MemberSdk.createInstance({
		prefix: window.UC_LIBSDK_PREFIX || '/merchant-gw',
		loginPlatform: window.uc_libsdk_getEquipmentByUrl(),
		onError: (data) => {
			if(data){
				if (data.result_code === '401') {
					window.location.href = '/frontend/login/logout';
				} else {
					console.log(`操作失败!，${data.msg}`);
				}
			}
		}
	});
})();
